@inherits VocaDb.Web.Code.HelperPage
@using System.Web.Mvc
@using VocaDb.Web.Code
@using VocaDb.Web.Helpers;

@helper BootstrapMedia(string url, HelperResult body, string heading, string thumbUrl) {
	<div class="media">
		@if (thumbUrl != null) {
			<a class="pull-left" href="@url">
				<img class="media-object" src="@thumbUrl" alt="Thumb" />
			</a>
		}
		<div class="media-body">
			@body
		</div>
	</div>
}

@* Transforms Markdown-formatted text into HTML. The input will be sanitized for any HTML tags first. *@
@helper FormatMarkdown(string text) {
	@Html.Raw(MarkdownParser.GetHtml(text))
}

@helper LanguageFlag(string languageCode) {
	if (!string.IsNullOrEmpty(languageCode)) {
		 <img src="@Url.StaticResource("/img/languageFlags/" + languageCode + ".png")" alt="@languageCode" title="@languageCode" />
	} else {
		 <img src="@Url.StaticResource("/img/languageFlags/unknown.png")" alt="@VocaDb.Web.Resources.Domain.Globalization.InterfaceLanguageStrings.Other" title="@VocaDb.Web.Resources.Domain.Globalization.InterfaceLanguageStrings.Other" />
	}
}

@helper MetaTag(string name, string content) {
	if (!string.IsNullOrEmpty(content)) {
		<meta name="@name" content="@content" />
	}
}

@helper OpenGraphMetaTags(PagePropertiesData pageProperties) {
	@MetaTag("og:url", pageProperties.CanonicalUrl)
	@MetaTag("og:title", pageProperties.OpenGraph.Title)
	@MetaTag("og:description", pageProperties.OpenGraph.Description)
	@MetaTag("og:type", pageProperties.OpenGraph.Type)
}